	export default class Product {
		
		constructor(id, name, price, imageUrl, stock, category = '', sales = 0, createTime = '', isFavorite = false) {
			this.id = id;
			this.name = name;
			this.price = price;
			this.imageUrl = imageUrl;
			this.stock = stock;
			this.category = category;        // 商品分类
			this.sales = sales;              // 销量
			this.createTime = createTime;    // 上架时间
			this.isFavorite = isFavorite;    // 是否收藏
		}
		
		static parseFromJsonString(jsonString) {
			let jsonObject = JSON.parse(jsonString);
			return new Product(
				jsonObject.id,
				jsonObject.name,
				jsonObject.price,
				jsonObject.imageUrl,
				jsonObject.stock,
				jsonObject.category,
				jsonObject.sales,
				jsonObject.createTime,
				jsonObject.isFavorite
			);
		}

	}